package com.JobFind.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;

@Controller
//控制层的Spring注解
@Scope("prototype")
//支持多例
@ParentPackage("struts-default")
public class BaseAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	PrintWriter getWriter() throws IOException {

		HttpServletResponse response = ServletActionContext.getResponse();
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		return response.getWriter();
	}
	
	HttpSession getSession(){		
		HttpServletRequest request = ServletActionContext.getRequest();
		return request.getSession();	
	}

}
